# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: AndyRTR <andyrtr@archlinux.org>

pkgname=hyphen-hu
pkgver=20110815
_lo_ver=7.3.2
pkgrel=2
pkgdesc="Hungarian hyphenation rules"
arch=(any)
url="http://magyarispell.sourceforge.net/"
license=(LGPL GPL MPL)
optdepends=('hyphen: offers hyphenation library functions')
source=(https://download.documentfoundation.org/libreoffice/stable/${_lo_ver}/rpm/x86_64/LibreOffice_${_lo_ver}_Linux_x86-64_rpm_langpack_hu.tar.gz{,.asc})
validpgpkeys=('C2839ECAD9408FBE9531C3E9F434A1EFAFEEAEA3') # "LibreOffice Build Team (CODE SIGNING KEY) <build@documentfoundation.org>"
sha256sums=('7c36145daab693c4b77224dd0ac0e904fec3350ad0df11d88076d401fb6d1976'
            'SKIP')

prepare() {
  bsdtar -x -f LibreOffice_*_Linux_x86-64_rpm_langpack_hu/RPMS/libreoffice*-dict-hu-*.x86_64.rpm
}

package() {
  cd opt/libreoffice*/share/extensions/dict-hu/
  install -Dm644 hyph_hu_HU.dic "$pkgdir/usr/share/hyphen/hyph_hu_HU.dic"

  # the symlinks
  install -dm755 "$pkgdir/usr/share/myspell/dicts"
  pushd "$pkgdir/usr/share/myspell/dicts"
    for file in "$pkgdir"/usr/share/hyphen/*; do
      ln -sv /usr/share/hyphen/$(basename $file) .
    done
  popd

  # docs
  install -Dm644 README_hyph_hu_HU.txt "$pkgdir/usr/share/doc/$pkgname/README_hyph_hu_HU.txt"
}
